import time

#假如说你有一个博客注册的时间为2018,9,17注册，到现在时间为止一共经历了多少时间

Time = "2020-5-16"
resgitertime = time.mktime(time.strptime(Time,"%Y-%m-%d"))

timnow = time.time()
timedelta = timnow-resgitertime
print(timedelta)
struct_timedelta = time.localtime(timedelta)#
print(struct_timedelta)
if struct_timedelta.tm_year-1970 == 0 and struct_timedelta.tm_mon-1==0:
    print("博客的使用时间%s天"%(struct_timedelta.tm_mday-1))
elif struct_timedelta.tm_year-1970 != 0 and struct_timedelta.tm_mon-1==0:
    print("博客的使用时间%s年%s天" % (struct_timedelta.tm_year - 1970, struct_timedelta.tm_mday - 1))
elif struct_timedelta.tm_mon-1 != 0 and struct_timedelta.tm_year-1970 == 0 :
    print("博客的使用时间%s月%s天" % (struct_timedelta.tm_mon - 1, struct_timedelta.tm_mday - 1))
else:
    print("博客的使用时间%s年%s月%s天" % (struct_timedelta.tm_year - 1970,struct_timedelta.tm_mon-1, struct_timedelta.tm_mday - 1))

